package com.beiing.tianshuai.tianshuai.interest.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.interest.entity.InterestBean;
import com.beiing.tianshuai.tianshuai.interest.model.InterestModel;
import com.beiing.tianshuai.tianshuai.interest.model.InterestModelImpl;
import com.beiing.tianshuai.tianshuai.interest.view.InterestViewImpl;

/**
 * Created by Jinni on 2017/11/19
 */

public class InterestPresenter extends BasePresenter implements InterestPresenterImpl, InterestModel.OnInterestResponseListener{

    private InterestViewImpl mView;
    private InterestModelImpl mModel;

    public InterestPresenter(InterestViewImpl view) {
        mView = view;
        mModel = new InterestModel(this);
    }

    @Override
    public void getInterestInfo(String typeName, String pageSize, String lastId, String uid, int pageNum) {
        mView.showProgress();
        mModel.getInterestInfo(typeName, pageSize, lastId, uid, pageNum);
    }

    @Override
    public void getPriseResult(String vid, String uid, String controller) {
        mModel.getPriseResult(vid, uid, controller);
    }

    @Override
    public void getVideoReport(String vid, String uid, String content) {
        mView.showProgress();
        mModel.getVideoReport(vid, uid, content);
    }

    @Override
    public void onSuccess(InterestBean bean) {
        mView.onRequestSuccess(bean);
        mView.hideProgress();
    }

    @Override
    public void onReportSuccess(CodeBean bean) {
        mView.onReportSuccess(bean);
        mView.hideProgress();
    }

    @Override
    public void onError(Throwable throwable, int errorType) {
        mView.onRequestFailed(throwable);
        mView.hideProgress();
    }
}
